package main

import (
	"fmt"
	"time"
)

func main()  {
	timeout := make (chan bool, 1)
	ch := make (chan int)

	go func() {

		a := <-ch
		fmt.Println(a)

		time.Sleep(1e9) // sleep one second
		timeout <- true
	}()

	ch <- 123



	select {
	case <-ch:
		fmt.Println("----------", <-ch)
	case <- timeout:
		fmt.Println("timeout!")
	}
}